package excel

func (x *xlsx) AddPicture(index any, cell, picture, format string) error {
	cell = rc2cell(cell)
	active_name, _, e := x.getSheetAndIndex(index)
	if e != nil {
		return e
	}
	return x.f.AddPicture(active_name, cell, picture, format)
}

func (x *xlsx) AddPictureFromBytes(index any, cell, format, name, extension string, file []byte) error {
	cell = rc2cell(cell)
	active_name, _, e := x.getSheetAndIndex(index)
	if e != nil {
		return e
	}
	return x.f.AddPictureFromBytes(active_name, cell, format, name, extension, file)
}

func (x *xlsx) GetPicture(index any, cell string) (string, []byte, error) {
	cell = rc2cell(cell)
	active_name, _, e := x.getSheetAndIndex(index)
	if e != nil {
		return "", nil, e
	}

	return x.f.GetPicture(active_name, cell)
}
